package com.qk.mapper;

import com.qk.entity.Activity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ActivityMapper {

    List<Activity> selectList(Integer channel, Integer type, Integer status);

    @Delete("delete from activity where id= #{id}")
    void delete(Integer id);
    @Insert("insert into activity(name,channel,type,description,start_time,end_time,discount,voucher,create_time,update_time) " +
            "values(#{name},#{channel},#{type},#{description},#{startTime},#{endTime},#{discount},#{voucher},#{createTime} ,#{updateTime})")
    void add(Activity activity);
    @Select("select * from activity where id = #{id} ")
    Activity selectById(Integer id);

    void update(Activity activity);
    @Select("select * from activity where type = #{type} ")
    List<Activity> listByType(Integer type);
}
